/*
 ----------------------------------------------------------------------------------
                          "THE BEER-WARE COPYRIGHT LICENSE"
                                    (Revision 43)
                                     -----------
   Rymek [rymek@rymek.org] wrote this file. As long as You retain this notice and
   this file has been sent directly to You by the author, You can do whatever You
   want with this stuff as long as You don't sell or rent it. If we meet some day,
   and You think this stuff is worth it, You can buy me a beer in return :-)
                                                                __________
                                                                Paweł Rymaszewski
 ----------------------------------------------------------------------------------
 */

package ui.windows.forms.searchForm;

import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;

/**
 * Class handles events related to selection in JTable
 * Created to fix problems with invalid index exceptions thrown
 * while user selected row in JTable while it was updating
 *
 * @author rymek
 *         User: rymek
 *         Date: 02.09.11
 *         Time: 11:00
 */
class ParsedResultTableListSelectionListener implements ListSelectionListener {

    private int currentSelectedRow;       // current selected row in JTable

    /**
     * Saves last selected index in JTable
     *
     * @param e selection event
     */
    @Override
    public void valueChanged(ListSelectionEvent e) {
        this.currentSelectedRow = e.getLastIndex();
    }

    public int getCurrentSelectedRow() {
        return currentSelectedRow;
    }
}
